<?php if (!defined('THINK_PATH')) exit(); /*a:4:{s:54:"/www/jilly/public/../application/view/index/login.html";i:1545723718;s:45:"/www/jilly/application/view/layout/index.html";i:1541172680;s:29:"static/html/index_header.html";i:1541421342;s:29:"static/html/index_footer.html";i:1538018910;}*/ ?>
<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="”Cache-Control”" content="”no-transform”">
    <meta http-equiv="”Cache-Control”" content="”no-siteapp”">
    <!-- 百度收录start -->
    <meta name="baidu-site-verification" content="fBCVU8Appn" />
    <!-- 百度收录end -->
    <meta name="keywords" content="Dink、QQ三国">
    <meta name="description" content="最业余的saas管理平台">
    <title><?php echo (isset($title) && ($title !== '')?$title:'Jilly的小宇宙'); ?></title>
    <link rel="stylesheet" type="text/css" href="/static/js/dink/layui/css/layui.css" />
    <link rel="stylesheet" type="text/css" href="/static/js/dink/dink.css" />
    <script type="text/javascript" src="/static/js/dink/jquery.js"></script>
    <script type="text/javascript" src="/static/js/dink/pjax.js"></script>
    <script type="text/javascript" src="/static/js/dink/layui/layui.all.js"></script>
    <script type="text/javascript" src="/static/js/dink/layui/layui.js"></script>
    <script type="text/javascript" src="/static/js/dink/dink.js"></script>
    <script type="text/javascript" src="/static/js/dink/public.js"></script>
</head>
<style>
    body{background-image: url('/static/img/index/bg.jpg');background-size: cover;}
    .layui-form{width:350px;border: 1px solid #eee;padding: 30px;margin: 0 auto;
        border-radius: 10px;background: #fff;box-shadow: 0 12px 24px rgba(0,0,0,0.24);
        margin-top: 20%;opacity: 0.8;}
    .layui-form-title{text-align: center;margin-bottom: 20px;font-size: 25px;}
    .layui-form-item{position: relative;height:40px;}
    .layui-icon{position: absolute;left: 1px;top: 1px;width: 40px;
        text-align: center;line-height: 40px;color: #888;}
    .layui-input{padding-left: 45px;height: 40px;border-radius: 5px;}
</style>

<body>
    <div class="layui-container">
        <!--登录表单start-->
        <div class="layui-form">
            <div class="layui-form-title"><?php echo PN; ?>后台管理系统</div>
            <div class="layui-form-item">
                <label class="layui-icon layui-icon-username"></label>
                <input type="text" class="layui-input" name="user" placeholder="请输入邮箱/手机号" autocomplete="off">
            </div>
            <div class="layui-form-item">
                <label class="layui-icon layui-icon-password"></label>
                <input type="password" class="layui-input" name="password" placeholder="密码" autocomplete="off">
            </div>
            <div class="layui-form-item">
                <label class="layui-icon layui-icon-vercode"></label>
                <input type="text" id="code_check" class="layui-input" placeholder="验证码" autocomplete="off" style="width:50%;">
                <div id="code_get" style="position: absolute;right:0px;bottom:10px;"></div>
            </div>
            <div class="layui-form-item">
                <button id="login" class="layui-btn layui-btn-fluid layui-bg-cyan">登陆</button>
            </div>
        </div>
        <!--登录表单end-->
    </div>
</body>

<script>
    $(function(){
        //获取图片验证码
        dink.code.get('code_get');
        //end

        //input自动获取鼠标焦点
        $('input[name=user]').focus();
        //end
    });

    //登录click事件
    $(document).on('click','#login',function(){
        var code_check = dink.code.check('code_check');
        if(!code_check){
            layer.msg('验证码不正确');return;
        }
        var url = '/handler/login/doLogin';
        var base = {};
        base.user = $('input[name=user]').val();
        base.password = $('input[name=password]').val();
        var data = {base:base};
        $.post(url,data,function(e){
            if(e.ret == 1){
                var default_href = (e.type == 2) ? '/admin/index' : '/index';
                var tmp_href = dink.getUrlParam('url');
                var href = tmp_href ? tmp_href : default_href;
                layer.msg(e.msg,{time:1000},function(){
                    location.href = href;
                });
            }else{
                layer.msg(e.msg);return;
            }
        },'json');
    });

    //键盘按键事件
    $(document).keyup(function(e){
        var user = $('input[name=user]');
        var password = $('input[name=password]');
        var code_check = $('#code_check');

        //回车键事件
        if(e.keyCode == 13){
            if(user.val()){
                if(password.val()){
                    if(code_check.val()){
                        $('#login').trigger('click');
                    }else{
                        code_check.focus();
                    }
                }else{
                    password.focus();
                }
            }else{
                user.focus();
            }
        }
        //end

        //方向键事件
        if(e.keyCode == 38){
            if(password.is(':focus')){
                user.focus();
            }else if(code_check.is(':focus')){
                password.focus();
            }
        }
        if(e.keyCode == 40){
            if(user.is(':focus')){
                password.focus();
            }else if(password.is(':focus')){
                code_check.focus();
            }
        }
    });
</script>

</html>